#ifndef H_MCX
#define H_MCX

#include <libxml/tree.h>
#include <time.h>
#include <xmlsec/keys.h>
#include <glib.h>

char *mcx_time(time_t);
xmlNodePtr mcx_sign(xmlNodePtr, xmlSecKeyPtr);
xmlSecKeyPtr mcx_loadkey(char *);
xmlDocPtr mcx_send(char *, xmlDocPtr);
xmlDocPtr mcx_doc_new(const char *, const char *, const char *, xmlNsPtr *, xmlNodePtr *);
xmlDocPtr mcx_send_raw(char *, xmlDocPtr);
void mcx_debug_set(int);
int mcx_debug_get();

xmlNodePtr mcx_amount(xmlDocPtr, xmlNsPtr *, char *, char *);
xmlNodePtr mcx_validityInterval_offset(xmlDocPtr, xmlNsPtr *, int, int);

xmlDocPtr mcx_authority(xmlNodePtr, char *, char *);
GHashTable *mcx_balance(xmlSecKeyPtr);
xmlDocPtr mcx_balance_request();
GHashTable *mcx_balanceStatus_parse(xmlDocPtr);
GTree *mcx_history(xmlSecKeyPtr);
xmlDocPtr mcx_history_request(xmlSecKeyPtr);
GTree *mcx_transactionList_parse(xmlDocPtr);
GHashTable *mcx_drawdown(xmlSecKeyPtr, xmlDocPtr, char *, char *);
xmlDocPtr mcx_drawdown_request(xmlSecKeyPtr, xmlDocPtr, char *, char *);

struct mcx_transaction {
  char *mt_time;
  char *mt_amount;
  char *mt_currency;
  int mt_debit;
  int mt_authority;
  int mt_drawdown;
};

struct mcx_transaction *mcx_transaction_parse(xmlNodePtr);
  
extern const char ns_mcx[];
extern const char ns_mcxws[];

xmlDocPtr validateXml(const char *, xmlDocPtr);
xmlDocPtr validateXmlFile(const char *, const char *);
xmlDocPtr validateXmlMem(const char *schema, const char *, int);

#endif /* !H_MCX */
